Acing the Certified Kubernetes Administrator Exam by Chad Crowell;

Acing the Certified Kubernetes Administrator Exam by Chad Crowell;

Author:Chad Crowell; [Crowell, Chad M.]
Language: eng
Format: epub
Publisher: Simon & Schuster
Published: 0101-01-01T00:00:00+00:00


Figure 6.12 A LoadBalancer-type Service, which is a superset of the NodePort- and ClusterIP-type Services, provides a single entry point into the cluster and the underlying Pods.

6.4.1 ClusterIP Service

The ClusterIP Service is for internal cluster communication only. You would usually create a Service like this to communicate from the frontend of your application, in one Pod in the cluster, to the backend, which is in a different Pod. You can specify the ports to use when you create the Service initially, or you can modify it later. Like a lot of other resources in Kubernetes, you can run an imperative command to create a Service like k create svc clusterip internal-svc --tcp 8080:80, or you can create a YAML spec file with the command k create svc clusterip internal-svc --tcp 8080:80 -dry-run=client -o yaml > svc.yaml. Go ahead and run the latter command and take a look at the YAML spec by opening in it Vim with the command vim svc.yaml. You’ll see, as in figure 6.13, in the ports section, that there’s a port and a target port. The target port is the port that’s exposed on the container itself. Not all containers have exposed ports, but in the case of the nginx image, for example, port 80 is exposed.

The exposed port is defined in the Dockerfile (how the image is built), so if you’re ever wondering what ports the container is exposed on, look at the Dockerfile for that image. Going back to the Service YAML, the port is exposed within the cluster, as in figure 6.12 where the port is 80. You can have multiple Services with the same port exposed because each Service has its own IP address and DNS name, which allows an incoming request to differentiate between Services. As long as the Service name is different, you can have as many Services as you want with port 80 exposed. Notice in the YAML spec that this Service has a selector, as in figure 6.13. This is how the Service can bind itself to Pods. Any Pod with the label app=internal-svc, in this case, will be associated with that Service. This works similarly to nodeSelectors, which we touched on in section 4.1.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Popular ebooks
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9757)
Red Hat Certified Specialist in Services Management and Automation EX358 Exam Guide by Eric McLeroy(5833)
The KCNA Book by Nigel Poulton(4080)
Microsoft Security, Compliance, and Identity Fundamentals Exam Ref SC-900 by Dwayne Natwick(3442)
Designing and Implementing Microsoft Azure Networking Solutions by David Okeyode(3340)
Microsoft Security Operations Analyst Exam Ref SC-200 Certification Guide by Trevor Stuart and Joe Anich(3300)
Microsoft Security Operations Analyst Exam Ref SC-200 Certification Guide by Trevor Stuart & Joe Anich(3204)
TCP IP by Todd Lammle(2959)
Microsoft Power BI Data Analyst Certification Guide by Ed Corcoran Orrin Edenfield(2908)
MCSA Windows Server 2016 Study Guide: Exam 70-740 by William Panek(2508)
Unity Certified Programmer: Exam Guide by Philip Walker(2386)
Networking A Beginner's Guide by Bruce Hallberg(2193)
Microsoft Power Platform Solution Architect's Handbook by Hugo Herrera(2013)
31 Days Before Your CompTIA A+ Exams (Shanette Luellen's Library) by Benjamin Patrick Conry(1846)
CompTIA A+ Practice Tests Core 1 (220-1101) and Core 2 (220-1102) by Ian Neil and Mark Birch(1770)
MCSA Windows Server 2016 Study Guide: Exam 70-741 by William Panek(1655)
PHP 7 Zend Certification Study Guide by Andrew Beak(1629)
Healthcare Information Security and Privacy (All-In-One) by Sean Murphy(1537)
CompTIA A+ Certification Guide (220-901 and 220-902) by Matthew Bennett(1514)
RHCSA & RHCE Red Hat Enterprise Linux 7: Training and Exam Preparation Guide (EX200 and EX300), Third Edition by Asghar Ghori(1471)